import com.alibaba.druid.filter.config.ConfigTools;
import com.phoenix.mysql.MySQLApplication;
import com.phoenix.mysql.entity.User;
import com.phoenix.mysql.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/***
 * @Auther: 汪孟飞
 * @Description:
 * @Date: 2025-05-23 21:46
 * @Copyright:
 ***/
@Slf4j
@SpringBootTest(classes = MySQLApplication.class)
public class test01 {

    @Autowired
    private UserService userService;

    @Test
    public void test(){
        User u1 = new User();
        u1.setAddress("安徽省安庆市望江县");
        u1.setAge(29);
        u1.setName("汪孟飞");
        if(userService.save(u1)){
            System.out.println("插入成功！！！");
        }
        System.out.println("失败了");
    }


    @Test
    public void decryt() throws Exception {
        //用于敏感信息加解密
        String password = "root";
        String[] arr = ConfigTools.genKeyPair(512);
        //私钥
        log.info("private key:{}",arr[0]);
        //公钥
        log.info("public key:{}",arr[1]);

        //通过私钥加密密码
        String encode = ConfigTools.encrypt(arr[0],password);
        log.info("password：{}",encode);

    }

}
